home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 033a / ttalm011.zip / ALMANAC.A86 < prev    next >
Text File  |  1991-12-17  |  26KB  |  991 lines

  1. ;**************************************************
  2. ;Print out header and copyright notce
  3. ;**************************************************
  4. START:
  5.      lea  dx,crn
  6.      mov  ah,9
  7.      int  021
  8.      jmp  END_START
  9.  
  10. crn       db 0d,0a,0a,0a,0a,0a
  11.           db '          ██████████████████████████████████████████████████         ',0d,0a
  12.           db '          █▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█         ',0d,0a
  13.           db '          █▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓█         ',0d,0a
  14.           db '          █▓▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒▓█         ',0d,0a
  15.           db '          █▓▒░                                          ░▒▓█         ',0d,0a
  16.           db '          █▓▒░               ALMANAC.COM                ░▒▓█         ',0d,0a
  17.           db '          █▓▒░                                          ░▒▓█         ',0d,0a
  18.           db '          █▓▒░         Copyright 1991 Sam Watson        ░▒▓█         ',0d,0a
  19.           db '          █▓▒░v01.1                                     ░▒▓█         ',0d,0a
  20.           db '          █▓▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒▓█         ',0d,0a
  21.           db '          █▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓█         ',0d,0a
  22.           db '          █▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█         ',0d,0a
  23.           db '          ██████████████████████████████████████████████████         ',0d,0a
  24.           db 0d,0a,0a,'$'
  25.  
  26. ;**************************************************
  27. ;End and exit to dos
  28. ;**************************************************
  29. endit:
  30.      int  020
  31.  
  32. END_START:
  33. ;**************************************************
  34. ;retreive config information
  35. ;**************************************************
  36. config_in:
  37.      lea  dx,config_file      ;Open the XXXXX.cfg file
  38.      mov  ax,03d00
  39.      int  021
  40.      jnc  >l1
  41.      lea  bx,config_in        ;Error detected es:bx has
  42.      mov  es,cs               ; retry address, ax has error
  43.      jmp  disk_open_error     ; code
  44. l1:  mov  w handle,ax         ;Save file handle
  45. l2:  mov  bx,w handle         ;Read ulist.cfg into memory
  46.      mov  cx,1024
  47.      lea  dx,config_info
  48.      mov  ah,03f
  49.      int  021
  50.      jnc  >l1
  51.      lea  bx,l2               ;Error detected es:bx has
  52.      mov  es,cs               ; retry address, ax has error
  53.      jmp  disk_read_error     ; code
  54. l1:  mov  bx,w handle         ;Close the ulist.cfg file
  55.      mov  ah,03e
  56.      int  021
  57.      jnc  >l1
  58.      lea  bx,l1               ;Error detected es:bx has
  59.      mov  es,cs               ; retry address, ax has error
  60.      jmp  disk_close_error    ; code
  61. l1:  lea  bx,config_info      ;Place 00 between data
  62.      mov  si,bx               ;Save address for backfill
  63.      mov  ax,0
  64. l2:  cmp  b[bx],0D            ;Find Carrage Return
  65.      je   fill_two_00
  66.      cmp  b[bx],';'           ;Find begin of comment
  67.      je   fill_com_00
  68.      cmp  b[bx],0             ;Find zeros
  69.      je   back_fill
  70.      inc  bx
  71.      jmp  l2
  72. fill_two_00:
  73.      mov  w[bx],ax
  74.      add  bx,2
  75.      jmp  l2
  76. fill_com_00:
  77. l3:  mov  b[bx],al
  78.      inc  bx
  79.      cmp  b[bx],0d            ;Find Carrage Return
  80.      jne  l3
  81.      jmp  fill_two_00
  82. back_fill:
  83.      cmp  si,bx               ;Fill in spaces at end
  84.      jne  >l1
  85.      jmp  PLACE_CFG
  86. l1:  cmp  w[bx],00020         ;Space & 00
  87.      jne  >l3
  88. l1:  mov  b[bx],al
  89.      dec  bx
  90. l2:  jmp  back_fill
  91. l3:  cmp  w[bx],0009          ;Tab & 00
  92.      je   l1
  93.      dec  bx
  94.      jmp  back_fill
  95.  
  96. config_file:   db 'almanac.cfg',0
  97. handle:        dw 0
  98. config_info:   db 1024 dup(0)
  99.  
  100. ;**************************************************
  101. disk_open_error:
  102. ;**************************************************
  103.      push ax
  104.      lea  dx,doemesg          ;output message
  105.      mov  ah,9
  106.      int  021
  107.      pop  ax
  108.      jmp  endit
  109. doemesg:  db 'There was an error opening a file$'
  110. ;**************************************************
  111. disk_close_error:
  112. ;**************************************************
  113.      push ax
  114.      lea  dx,dcemesg          ;output message
  115.      mov  ah,9
  116.      int  021
  117.      pop  ax
  118.      jmp  endit
  119. dcemesg:  db 'There was an error closeing a file$'
  120. ;**************************************************
  121. disk_read_error:
  122. ;**************************************************
  123.      push ax
  124.      lea  dx,dremesg          ;output message
  125.      mov  ah,9
  126.      int  021
  127.      pop  ax
  128.      jmp  endit
  129. dremesg:  db 'There was an error reading a file$'
  130. ;**************************************************
  131. ;Place configuration information into place
  132. ;**************************************************
  133. PLACE_CFG:
  134.      lea  bx,config_info      ;Config information
  135.      mov  si,cx,0             ;Address placement counter
  136.      lea  di,bbs_path         ;Find BBS Path name
  137.      call find_start
  138.      jnc  >l1
  139.      jmp  config_error
  140. l1:  push cx
  141.      call find_end
  142.      pop  dx
  143.      jnc  >l2
  144.      jmp  config_error
  145. l2:  mov  ax,cx
  146.      sub  ax,dx
  147.      cmp  ax,40
  148.      jbe  >l1
  149.      jmp  config_error
  150. l1:  lea  di,out_file         ;Find Output path
  151.      call find_start          ; and file name
  152.      jnc  >l1
  153.      jmp  config_error
  154. l1:  push cx
  155.      call find_end
  156.      pop  dx
  157.      jnc  >l2
  158.      jmp  config_error
  159. l2:  mov  ax,cx
  160.      sub  ax,dx
  161.      cmp  ax,40
  162.      jbe  >l1
  163.      jmp  config_error
  164. l1:  lea  di,sysop            ;Find SYSOP name
  165.      call find_start
  166.      jnc  >l1
  167.      jmp  config_error
  168. l1:  push cx
  169.      call find_end
  170.      pop  dx
  171.      jnc  >l2
  172.      jmp  config_error
  173. l2:  mov  ax,cx
  174.      sub  ax,dx
  175.      cmp  ax,30
  176.      jbe  >l1
  177.      jmp  config_error
  178. l1:  lea  di,bbs              ;Find BBS name
  179.      call find_start
  180.      jnc  >l1
  181.      jmp  config_error
  182. l1:  push cx
  183.      call find_end
  184.      pop  dx
  185.      jnc  >l2
  186.      jmp  config_error
  187. l2:  mov  ax,cx
  188.      sub  ax,dx
  189.      cmp  ax,30
  190.      jbe  >l1
  191.      jmp  config_error
  192. l1:  lea  di,phone            ;Find BBS Phone number
  193.      call find_start
  194.      jnc  >l1
  195.      jmp  config_error
  196. l1:  push cx
  197.      call find_end
  198.      pop  dx
  199.      jnc  >l2
  200.      jmp  config_error
  201. l2:  mov  ax,cx
  202.      sub  ax,dx
  203.      cmp  ax,15
  204.      jbe  place_info
  205.      jmp  config_error
  206. place_info:
  207.      lea  di,line5            ;Place BBS name on
  208.      add  di,2
  209.      lea  si,bbs
  210.      cld
  211. l1:  cmp  b[si],0
  212.      je   >l2
  213.      movsb
  214.      jmp  l1
  215. l2:  lea  di,line5            ;Place phone number on
  216.      add  di,62
  217.      lea  si,phone
  218.      push si
  219.      dec  si
  220. l3:  inc  si
  221.      cmp  b[si],0
  222.      jne  l3
  223.      mov  cx,si
  224.      pop  si
  225.      sub  cx,si
  226.      sub  di,cx
  227.      cld
  228.      rep  movsb
  229.      lea  di,line6            ;Place sysop name
  230.      add  di,8
  231.      lea  si,sysop
  232.      cld
  233. l1:  cmp  b[si],0
  234.      je   >l2
  235.      movsb
  236.      jmp  l1
  237. l2:  jmp  END_CFG             ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  238.  
  239. bbs_path:      db 56 dup(0)
  240. sysop:         db 31 dup(0)
  241. bbs:           db 31 dup (0)
  242. phone:         db 16 dup (0)
  243.  
  244. ;*************************
  245. find_start:
  246. ;*************************
  247.      clc
  248. l1:  cmp  b[bx+si],0
  249.      jne  >l2
  250.      inc  si,cx
  251.      cmp  cx,1024
  252.      jne  l1
  253.      stc
  254. l2:  ret
  255. ;*************************
  256. find_end:
  257. ;*************************
  258.      clc
  259. l1:  mov  al,b[bx+si]
  260.      cmp  al,0
  261.      je   >l2
  262.      mov  b[di],al
  263.      inc  di,cx,si
  264.      cmp  cx,1024
  265.      jne  l1
  266.      stc
  267. l2:  ret
  268. ;*************************
  269. config_error:
  270. ;*************************
  271.      lea  dx,cfgerror
  272.      mov  ah,9
  273.      int  021
  274.      int  020
  275. cfgerror:      db 0a,0a,0a,0d
  276.                db 'There is an error in XXXXX.CFG.',0a,0a,0a,0d,'$'
  277. END_CFG:
  278. ;**************************************************
  279. ;Create output file
  280. ;**************************************************
  281. create_out:
  282.      lea  dx,out_file         ;Create the output file
  283.      mov  ah,03c
  284.      mov     cx,00
  285.      int  021
  286.      jnc  >l1
  287.      lea  bx,create_out       ;Error detected es:bx has
  288.      mov  es,cs               ; retry address, ax has error
  289.      jmp  disk_create_error   ; code
  290. l1:  jmp  PLACE_H             ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  291.  
  292. ;**************************************************
  293. disk_create_error:
  294. ;**************************************************
  295.      push ax
  296.      lea  dx,dcremesg         ;output message
  297.      mov  ah,9
  298.      int  021
  299.      pop  ax
  300.      jmp  endit
  301. dcremesg:      db 'There was an error creating a file$'
  302. out_file:      db 41 dup(0)
  303. line1:         db 0c
  304.                db '╔',62 dup('═'),'╗',0d,0a
  305. line2:         db '║ Ye Old BBS Almanac',24 dup(' '),'Todays Reflections ║',0d,0a
  306. line3:         db '╠',62 dup('═'),'╣',0d,0a
  307. line5:         db '║',62 dup(' '),'║',0d,0a
  308. line6:         db '║ SYSOP-',55 dup(' '),'║',0d,0a
  309. line7:         db '╚',62 dup('═'),'╝',0d,0a
  310.  
  311. ;**************************************************
  312. disk_write_error:
  313. ;**************************************************
  314.      push ax
  315.      lea  dx,dwemesg          ;output message
  316.      mov  ah,9
  317.      int  021
  318.      pop  ax
  319.      jmp  endit
  320. dwemesg:       db 'There was an error writeing a file$'
  321. ;**************************************************
  322. ;open output file and place header in the file
  323. ;**************************************************
  324. PLACE_H:
  325.      mov  w handle,ax         ;Save file handle
  326. l1:  mov  bx,w handle
  327. l2:  lea  dx,line1            ;Place header on out.txt
  328.      mov  cx,397
  329.      call    line_out
  330.      jnc  END_CONFIG          ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  331.      lea  bx,l2               ;Error detected es:bx has
  332.      mov  es,cs               ; retry address, ax has error
  333.      jmp  disk_write_error    ; code
  334. line_out:
  335.      mov  bx,w handle
  336.      mov  ah,040
  337.      int  021
  338.      ret
  339. END_CONFIG:
  340. ;**************************************************
  341. get_date:
  342. ;Get the date off the system and build output
  343. ;**************************************************
  344.  
  345.      mov  ah,02a              ;Get the system date
  346.      int  021
  347.      mov  b weekday_num,al
  348.      mov  b month_hex,dh
  349.      mov  b day_hex,dl
  350.      mov  w year_hex,cx
  351.      mov  bx,w year_hex       ;Convert year to decimal
  352.      call hex2bcd
  353.      mov  w year_num,ax
  354.      mov  bh,0
  355.      mov  bl,b day_hex        ;Convert day to decimal
  356.      call hex2bcd
  357.      mov  b day_num,al
  358.      mov  bl,b month_hex      ;Convert month to decimal
  359.      call hex2bcd
  360.      mov  b month_num,al
  361.      mov  al,bl
  362.      dec  al                  ;Convert month to ascii
  363.      lea  si,month_table
  364. l1:  cmp  al,0
  365.      je   >l4
  366. l2:  cmp  b[si],' '           ;Find SPACE
  367.      je   >l3
  368.      inc  si
  369.      jmp  l2
  370. l3:  dec  al
  371.      inc  si
  372.      jmp  l1
  373. l4:  lea  di,month_ascii
  374.      cld
  375. l1:  lodsb
  376.      stosb
  377.      cmp  al,' '
  378.      jne  l1
  379.      lea  si,weekday_table    ;Convert week day to ascii
  380.      mov  al,b weekday_num
  381.      mov  cx,0a
  382.      mul  cl
  383.      add  si,ax
  384.      mov  di,weekday_ascii
  385.      cld
  386.      rep  movsb
  387.      jmp  date_out
  388.  
  389. weekday_num:        db 0
  390. weekday_ascii:      db 10 dup(20)
  391. month_hex:          db 0
  392. month_num:          db 0
  393. month_ascii:        db 10 dup(20)
  394. day_hex:            db 0
  395. day_num:            db 0
  396. year_hex:           dw 0
  397. year_num:           dw 0
  398. weekday_table:      db 'Sunday    ','Monday    ','Tuesday   '
  399.                     db 'Wednesday ','Thursday  ','Friday    '
  400.                     db 'Saturday  '
  401. month_table:        db 'January Feburary March April May June '
  402.                     db 'July August September October November '
  403.                     db 'December '
  404. ;**************************************************
  405. hex2bcd:
  406. ;**************************************************
  407.      mov     ax,0
  408.      mov  cl,bh
  409.      cmp  cl,027         ;Grater than 027FF hex is invalid
  410.      jna  >l3
  411. l1:  mov  ax,-1
  412. l2:  ret
  413. l3:  ror  cl,1           ;4096 decimal equ digit
  414.      ror  cl,1
  415.      ror  cl,1
  416.      ror  cl,1
  417.      and  cl,0f
  418. l4:  jz   >l5
  419.      add  al,096
  420.      daa
  421.      xchg al,ah
  422.      adc  al,040
  423.      daa
  424.      xchg al,ah
  425.      dec  cl
  426.      jmp  l4
  427. l5:  mov  cl,bh          ;256 decimal equ digit
  428.      and  cl,0f
  429. l6:  jz   >l7
  430.      add  al,056
  431.      daa
  432.      xchg al,ah
  433.      adc  al,2
  434.      daa
  435.      jc   l1
  436.      xchg al,ah
  437.      dec  cl
  438.      jmp  l6
  439. l7:  mov  cl,bl
  440.      ror  cl,1           ;16 decimal equ digit
  441.      ror  cl,1
  442.      ror  cl,1
  443.      ror  cl,1
  444.      and  cl,0f
  445. l8:  jz   >l9
  446.      add  al,016
  447.      daa
  448.      xchg al,ah
  449.      adc  al,0
  450.      daa
  451.      jc   l1
  452.      xchg al,ah
  453.      dec  cl
  454.      jmp  l8
  455. l9:  mov  cl,bl
  456.      and  cl,0f          ;unit equ digit
  457. l5:  je   l2
  458.      add  al,1
  459.      daa
  460.      xchg al,ah
  461.      adc  al,0
  462.      daa
  463.      jc   l1
  464.      xchg al,ah
  465.      dec  cl
  466.      jmp  l5
  467. date_out:
  468. ;**************************************************
  469. ; Output line with date
  470. ;**************************************************
  471.      lea  dx,dateline
  472.      mov  di,dx
  473.      lea  si,weekday_ascii    ;Add day to line
  474.      mov  cx,0a
  475.      cld
  476.      rep  movsb
  477.      lea  si,month_ascii      ;Add month to line
  478. l1:  lodsb
  479.      stosb
  480.      cmp  al,' '              ;Look for SPACE
  481.      je   >l2
  482.      jmp  l1
  483. l2:  mov  al,b month_num      ;Convert decimal to ascii
  484.      mov  ah,al
  485.      mov  cx,4
  486.      ror  al,cl
  487.      and  ax,0f0f
  488.      or   ax,03030
  489.      mov  w month_num_ascii,ax
  490.      mov  al,b day_num        ;Add day to line
  491.      mov  ah,al
  492.      mov  cx,4
  493.      ror  al,cl
  494.      and  ax,0f0f
  495.      or   ax,03030
  496.      mov  w date_ascii,ax
  497.      stosw
  498.      mov  al,','              ;Add coma and space
  499.      mov  ah,' '
  500.      stosw
  501.      mov  al,b year_num[+1]   ;Add first part of year
  502.      mov  ah,al
  503.      mov  cx,4
  504.      ror  al,cl
  505.      and  ax,0f0f
  506.      or   ax,03030
  507.      stosw
  508.      mov  al,b year_num       ;Add second part of year
  509.      mov  ah,al
  510.      mov  cx,4
  511.      ror  al,cl
  512.      and  ax,0f0f
  513.      or   ax,03030
  514.      stosw
  515.      mov  cx,53
  516.      call line_out
  517.      jmp  find_user
  518.  
  519. dateline: db 50 dup(' '),0d,0a,0a
  520. bdayline: db 30 dup(' ')
  521. wish:     db " would like to wish it's users HAPPY BIRTHDAY!",0d,0a
  522. ;*************************
  523. create_bday_line:
  524. ;*************************
  525. l1:  lea  si,bbs               ;Place BBS name on
  526.      lea  di,bdayline
  527. l2:  lodsb
  528.      cmp  al,0
  529.      je   >l3
  530.      stosb
  531.      jmp  l2
  532. l3:  lea si,wish
  533. l4:  movsb
  534.      cmp  b[di-1],0a
  535.      jne  l4
  536.      lea  dx,bdayline
  537.      sub  di,dx
  538.      mov  cx,di
  539.      call line_out
  540.      ret
  541. ;**************************************************
  542. find_user:
  543. ;**************************************************
  544.      lea  si,bbs_path                  ;Open users file
  545.      lea  di,users_file
  546. l1:  lodsb
  547.      cmp  al,0
  548.      je   >l2
  549.      stosb
  550.      jmp  l1
  551. l2:  lea  si,us
  552.      mov  cx,15
  553.      rep  movsb
  554.      lea  dx,users_file
  555.      mov  ax,03d00
  556.      int  021
  557.      jnc  >l1
  558.      lea  bx,find_user
  559.      mov  es,cs
  560.      jmp  disk_open_error
  561. l1:  jmp  useropenok
  562.  
  563. user_handle: dw 0
  564. userdat:     db 164 dup(0)
  565. userflg:     db 0
  566. month_num_ascii: dw 0
  567. date_ascii       dw 0
  568.  
  569. useropenok:
  570.      mov  w user_handle,ax
  571. l1:  mov  bx,w user_handle             ;Read user file record
  572.      mov  cx,163
  573.      lea  dx,userdat
  574.      mov  ah,03f
  575.      int  021
  576.      jnc  >l2
  577.      lea  bx,l1
  578.      mov  es,cs
  579.      jmp  disk_read_error
  580. l2:  cmp  ax,0
  581.      jne  >l9
  582.      jmp  user_done
  583. l9:  lea  bx,userdat
  584.      mov  ax,w[bx+91]                  ;Check for birth month
  585.      cmp  ax,w month_num_ascii
  586.      jne  l1                           ;No match on month
  587.      mov  ax,w[bx+94]                  ;Check for birth date
  588.      cmp  ax,w date_ascii
  589.      jne  l1                           ;No match on date
  590.      cmp  b userflg,0
  591.      jne  birth_match
  592.      call create_bday_line
  593.      inc  b userflg
  594. birth_match:
  595.      mov  al,' '                       ;Clear out old info
  596.      mov cx,75
  597.      lea  di,name_line
  598.      rep  stosb
  599.      lea  di,name_line
  600.      add  di,5
  601.      lea  si,userdat
  602.      mov  cx,32
  603. l3:  lodsb                             ;Name
  604.      cmp  al,0
  605.      je   >l4
  606.      dec  cx
  607.      je   >l4
  608.      stosb
  609.      jmp  l3
  610. l4:  mov  al,' '
  611.      stosb
  612.      mov  ax,'fo'
  613.      stosw
  614.      mov  al,' '
  615.      stosb
  616.      mov  cx,32
  617.      lea  si,userdat                   ;City/state
  618.      add  si,47
  619. l5:  lodsb
  620.      cmp  al,0
  621.      je   >l6
  622.      dec  cx
  623.      je   >l6
  624.      stosb
  625.      jmp  l5
  626. l6:  lea  dx,name_line
  627.      mov  cx,77
  628.      call line_out
  629.      jmp  l1
  630.  
  631. name_line:  db 75 dup(" "),0d,0a
  632.  
  633. user_done:
  634.      mov  bx,w user_handle             ;Close user file record
  635.      mov  ah,03e
  636.      int  021
  637.      jnc  event
  638.      lea  bx,user_done
  639.      mov  es,cs
  640.      jmp  disk_close_error
  641.  
  642. users_file:  db 56 dup(0)
  643. us:          db '\work\users.dat'
  644.  
  645. ;**************************************************
  646. event:
  647. ;**************************************************
  648.      lea  dx,alm_eve                   ;Open almanac events
  649.      mov  ax,03d00
  650.      int  021
  651.      jnc  event_open
  652.      lea  bx,event
  653.      mov  es,cs
  654.      jmp  disk_open_error
  655. event_open:
  656.      mov  w alm_hand,ax
  657.      mov  cx,4096
  658.      mov  dx,alm_data
  659.      call alma_read
  660.      mov  w alm_char_e,ax              ;number of characters read
  661.      call match
  662.      if nc jmp birth                   ;If no events found
  663. more_eve:
  664.      call moveup
  665.      call match_cont
  666.      if c jmp more_eve
  667.      call almclose                     ;Close the event list
  668. eventout:                              ;Output event data
  669.      lea  dx,evehead                   ;Header
  670.      mov  cx,157
  671.      call line_out
  672.      lea  dx,alm_data                  ;Output events
  673.      mov  cx,w alm_char_b
  674.      call line_out
  675.      jmp  birth
  676.  
  677. evehead:   db 0a,'**************************************************',0d,0a
  678.            db '*             On This Day in History             *',0d,0a
  679.            db '**************************************************',0d,0a
  680. ;**************************************************
  681. birth:
  682. ;**************************************************
  683.      mov  w alm_char_b,0
  684.      mov  w alm_char_e,0
  685.      lea  dx,alm_bir                   ;Open almanac births
  686.      mov  ax,03d00
  687.      int  021
  688.      jnc  birth_open
  689.      jmp  disk_open_error
  690. birth_open:
  691.      mov  w alm_hand,ax
  692.      mov  cx,4096
  693.      mov  dx,alm_data
  694.      call alma_read
  695.      mov  w alm_char_e,ax              ;number of characters read
  696.      call match
  697.      if nc jmp reminder                ;If no births found
  698. more_bir:
  699.      call moveup
  700.      call match_cont
  701.      if c jmp more_bir
  702.      call almclose                     ;Close the birth list
  703. birthout:                              ;Output birth data
  704.      lea  dx,birhead                   ;Header
  705.      mov  cx,157
  706.      call line_out
  707.      lea  dx,alm_data                  ;Output events
  708.      mov  cx,w alm_char_b
  709.      call line_out
  710.      jmp  reminder
  711.  
  712. birhead:   db 0a,'**************************************************',0d,0a
  713.            db '*               Who was born today               *',0d,0a
  714.            db '**************************************************',0d,0a
  715. ;**************************************************
  716. reminder:
  717. ;**************************************************
  718.      mov  w alm_char_b,0
  719.      mov  w alm_char_e,0
  720.      lea  dx,alm_rem                   ;Open almanac reminders
  721.      mov  ax,03d00
  722.      int  021
  723.      jnc  rem_open
  724.      jmp  disk_open_error
  725. rem_open:
  726.      mov  w alm_hand,ax
  727.      mov  cx,4096
  728.      mov  dx,alm_data
  729.      call alma_read
  730.      mov  w alm_char_e,ax              ;number of characters read
  731. rem_redo:
  732.      call match
  733.      if nc jmp quote                   ;If no reminders found
  734.      push ax
  735.      mov  al,b[si+bx+2]
  736.      cmp  al,' '                       ;Ok if blank
  737.      if e jmp more_rem
  738.      and  al,0f                        ;Strip bias
  739.      cmp  al,b weekday_num
  740.      if ne jmp lx1
  741.      mov  b[si+bx+2],' '
  742.      jmp  more_rem
  743. lx1: pop  ax
  744.      jmp  rem_redo
  745. more_rem:
  746.      pop  ax
  747.      call moveup
  748. more_rem2:
  749.      call match_cont
  750.      if nc jmp remclose
  751.      push ax
  752.      mov  al,b[si+bx+2]
  753.      cmp  al,' '                       ;Ok if blank
  754.      if e jmp more_rem
  755.      and  al,0f                        ;Strip off bias
  756.      cmp  al,b weekday_num
  757.      if ne jmp lx2
  758.      mov  b[si+bx+2],' '
  759.      jmp  more_rem
  760. lx2: pop  ax
  761.      jmp  more_rem2
  762. remclose:
  763.      call almclose                     ;Close the reminder list
  764. reminderout:                           ;Output reminder data
  765.      lea  dx,remhead                   ;Header
  766.      mov  cx,157
  767.      call line_out
  768.      lea  dx,alm_data                  ;Output reminders
  769.      mov  cx,w alm_char_b
  770.      call line_out
  771.      jmp  quote
  772.  
  773. remhead:   db 0a,'**************************************************',0d,0a
  774.            db '*                Todays reminders                *',0d,0a
  775.            db '**************************************************',0d,0a
  776.  
  777. moveup:
  778.      push cx,bx,si,ax
  779.      add  si,bx
  780.      add  si,2                         ;Start of info after date
  781.      lea  di,alm_data
  782.      add  di,w alm_char_b              ;Placement of info
  783. l1:  lodsb
  784.      stosb
  785.      dec  cx
  786.      if z jmp sp_more_data
  787.      inc w alm_char_b
  788.      cmp al,0a                         ;End
  789.      jne l1
  790.      pop  ax,si,bx,cx
  791.      ret
  792. sp_more_data:
  793.      pop  ax,si,bx,cx
  794.      dec  w alm_char_b
  795.      call more_data
  796.      sub  bx,2
  797.      jmp moveup
  798. match:                                 ;Find match for date
  799.      mov  cx,w alm_char_e              ;Number of characters in buffer
  800.      lea  si,alm_data
  801.      mov  bx,w alm_char_b              ;Number of char held
  802. match_cont:
  803.      mov  ax,w month_num_ascii
  804. l1:  cmp  w[si+bx],ax                  ;Find month match
  805.      je   mon_match
  806. l5:  inc  bx                           ;Go to next LF
  807.      dec  cx
  808.      if z call more_data
  809. l2:  inc  bx
  810.      dec  cx
  811.      if z call more_data
  812.      cmp  w alm_char_e,0
  813.      if z jmp >l6
  814.      cmp  b[si+bx],0a
  815.      jne  l2
  816.      inc  bx
  817.      dec  cx
  818.      if z call more_data
  819.      cmp  w alm_char_e,0
  820.      if z jmp >l6
  821.      mov  ax,w month_num_ascii
  822.      jmp  l1
  823. mon_match:
  824.      inc  bx,bx                        ;Month match
  825.      dec  cx,cx
  826.      if z call more_data
  827.      cmp  w alm_char_e,0
  828.      if z jmp >l6
  829.      mov  ax,date_ascii
  830. l4:  cmp  w[si+bx],ax                  ;Find date match
  831.      if nz jmp l5
  832.      stc
  833.      ret                               ;Match found return
  834. l6:  clc                               ;No match retrun
  835.      ret
  836.  
  837. more_data:
  838.      push ax
  839.      mov  cx,4096                      ;Buffer size
  840.      if c sub cx,2                     ;If cary keep month
  841.      sub  cx,w alm_char_b              ;Subtract out number in
  842.      lea  dx,alm_data
  843.      add  dx,4096
  844.      sub  dx,cx
  845.      call alma_read
  846.      mov  w alm_char_e,cx,ax           ;Number of characters read
  847.      lea  si,alm_data
  848.      mov  bx,w alm_char_b
  849.      pop  ax
  850.      ret
  851. alma_read:                             ;Read ALMANC.xxx file
  852.      mov  bx,w alm_hand
  853.      mov  ah,03f
  854.      int  021
  855.      jnc  >l1
  856.      jmp  disk_read_error
  857. l1:  ret
  858. almclose:                              ;Close ALMANC.xxx file
  859.      mov  bx,w alm_hand
  860.      mov  ah,03e
  861.      int 021
  862.      if nc ret
  863.      jmp  disk_close_error
  864.  
  865. alm_bir:     db 'almanac.bir',0
  866. alm_eve:     db 'almanac.eve',0
  867. alm_rem:     db 'almanac.rem',0
  868. alm_quo:     db 'almanac.quo',0
  869. alm_hand:    dw 0
  870. alm_char_b:  dw 0
  871. alm_char_e:  dw 0
  872. alm_data:    db 4096 dup(?)
  873.  
  874. ;**************************************************
  875. quote:
  876. ;**************************************************
  877.      lea  dx,nam                       ;Open file and get numbers
  878.      mov  ax,03d00
  879.      int  021
  880.      jnc  >l1
  881.      jmp  disk_open_error
  882. l1:  mov  w hhd,ax                     ;Read
  883.      mov  bx,ax
  884.      mov  dx,offset anum
  885.      mov  cx,4
  886.      mov  ah,03f
  887.      int  021
  888.      mov  bx,w hhd                     ;Close
  889.      mov  ah,03e
  890.      int  021
  891.      mov  dx,offset nam                ;Delete file
  892.      mov  ah,041
  893.      int  021
  894.      inc  w anum
  895.      mov  bx,offset anum
  896.      mov  ax,w[bx]
  897.      cmp  ax,w[bx+2]
  898.      if e mov w anum,0
  899.      mov  ah,03c                       ;Open file to reset numbers
  900.      mov  dx,offset nam
  901.      mov  cx,0
  902.      int  021
  903.      mov  bx,ax                        ;Write
  904.      mov  ah,040
  905.      mov  cx,4
  906.      mov  dx,offset anum
  907.      int  021
  908.      mov  ah,03e                       ;Close
  909.      int  021
  910. start_quote:
  911.      lea  dx,alm_quo                   ;Open file for quotes
  912.      mov  ax,03d00
  913.      int  021
  914.      if c jmp disk_open_error
  915. quo_open:
  916.      mov  w alm_hand,ax
  917. quo_rd:                                ;Read Quote data
  918.      mov  cx,4096
  919.      lea  dx,alm_data
  920.      call alma_read
  921.      mov  di,ax
  922.      mov  cx,w anum
  923.      inc  cx
  924.      lea  si,alm_data
  925. l1:  dec  cx                            ;Go to correct al
  926.      if e jmp qo_st
  927. l2:  dec  di
  928.      if nz jmp >l3
  929.      push cx
  930.      mov  cx,4096                      ;Get more data
  931.      lea  dx,alm_data
  932.      call alma_read
  933.      mov  di,ax
  934.      lea  si,alm_data
  935.      pop  cx
  936. l3:  inc  si
  937.      cmp  b[si],0a
  938.      if ne jmp l2
  939.      inc  si
  940.      jmp  l1
  941. qo_st:
  942.      mov  cx,3
  943.      lea  dx,lf
  944.      call line_out
  945.      mov  cx,0
  946.      push si
  947. l1:  inc si,cx
  948.      cmp  b[si],0a
  949.      if e jmp >l2
  950.      cmp  cx,40
  951.      if b jmp l1
  952.      cmp  b[si],' '
  953.      if ne jmp l1
  954.      pop  dx
  955.      add  dx,cx
  956.      push dx
  957.      sub  dx,cx
  958.      call line_out
  959.      mov  cx,2
  960.      lea  dx,lf
  961.      call line_out
  962.      mov  cx,0
  963.      jmp  l1
  964. l2:  pop  dx
  965.      call line_out
  966. quo_clo:                ;Close quote
  967.      call almclose
  968.      jmp final
  969.  
  970. anum:    db 0,0,0,0
  971. nam:     db 'number.hex',0
  972. hhd:     dw 0
  973. lf:      db 0d,0a,0a
  974.  
  975. final:
  976.     mov    bx,w handle        ;Place tag to follow listing
  977.     lea    dx,tag
  978.     mov    cx,113
  979.     mov    ah,040
  980.     int    021
  981.  
  982.      mov bx,w handle
  983.      mov ah,03e
  984.      int 021
  985.      if nc jmp endit
  986.      call disk_close_error
  987.  
  988. tag:        db 0d,0a,0a,'ALMANAC.COM v01.1 written for TRITEL BBS '
  989.         db 'systems',0d,0a,'Copyright 1991 Sam Watson   '
  990.         db '(MY HOUSE BBS <708>739-9355)',0d,0a,0a,16
  991.